<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>
<style>
    .one{
        width: 200px;
        height: 200px;
        background-color:skyblue;
    }
    .two{
        width: 200px;
        height: 200px;
        background-color:yellowgreen;
    }
    .three{
        width: 200px;
        height: 200px;
        background-color:red;
    }
    .active{
        color: blue;
    }
</style>
<body>
    <div id="app">
        <!-- 
        class强制绑定写法允许是一个对象写法,对象的key就是类型,如果这个key对应的value是truthy的值,则这个类开启
       -->
       <div :class="className"></div>


       <!-- 练习 -->
       <div :class="isActive?'active':''">test active</div>
       <div :class="{active:isActive}">test active</div>
       
    </div>
   <script>
     const vm = new Vue({
        el:"#app",
        data(){
            return{
                className:{
                    one:true,
                    two:false,
                    three:false,
                },
                isActive:true,
            }
            
        }
    })
   </script>
</body>
</html>